﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.ComponentModel;

using xbmc_json_async.System;
using System.Drawing;

namespace xbmc_json_async.Types.Media.Details
{
    /// <summary>
    /// Media.Details.Base
    /// http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v3#Media.Details.Base
    /// </summary>
    public abstract class Base : xbmc_json_async.Types.Item.Details.Base
    {
        /// <summary>
        /// Gets the fanart URI.
        /// </summary>
        [DisplayName("Fan Art Uri"), Category("Artwork")]
        public Uri FanartUri 
        { 
            get 
            {
                if (fanart != string.Empty)
                {
                    return XHelpers.ArtworkUri(fanart);
                }
                return null;
            }
        }

        /// <summary>
        /// Gets the thumbnail URI.
        /// </summary>
        [DisplayName("Thumbnail Uri"), Category("Artwork")]
        public Uri ThumbnailUri
        {
            get
            {
                if (thumbnail != string.Empty)
                {
                    return XHelpers.ArtworkUri(thumbnail);
                }
                return null;
            }

        }

        /// <summary>
        /// Gets the thumbnail image.
        /// </summary>
        [DisplayName("Thumbnail Image"), Category("Artwork")]
        public Image ThumbnailImage
        {
            get
            {
                if (thumbnail != string.Empty)
                {
                    try
                    {
                        return XHelpers.GetImageFromThumbnail(thumbnail);
                    }
                    catch (Exception) { return null; }
                }
                return null;
            }
        }

        /// <summary>
        /// Gets the artwork image.
        /// </summary>
        [DisplayName("Fanart Image"), Category("Artwork")]
        public Image FanartImage
        {
            get
            {
                if (fanart != string.Empty)
                {
                    try
                    {
                        return XHelpers.GetImageFromThumbnail(fanart);
                    }
                    catch (Exception) { return null; }
                }
                return null;
            }
        }
        /// <summary>
        /// Gets or sets the fanart.
        /// </summary>
        /// <value>
        /// The fanart.
        /// </value>
        [DisplayName("Fan Art"), Category("Artwork")]
        public string fanart { get; set; }
        
        /// <summary>
        /// Gets or sets the thumbnail.
        /// </summary>
        /// <value>
        /// The thumbnail.
        /// </value>
        [DisplayName("Thumbnail"), Category("Artwork")]
        public string thumbnail { get; set; }
    }
}
